/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.hiddendanger.mapper;

import com.koron.hiddendanger.domain.CheckRecord;
import com.koron.hiddendanger.domain.HiddenDangerDiscovery;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface CheckRecordMapper {

    /**
     * g根据主键查询检查记录详情
     * @param id
     * @return
     */
    CheckRecord queryOne(@Param("id") String id);

    /**
     * 根据指定条件查询检查记录列表
     * @param userCode
     * @param corpCode
     * @param gridCode
     * @param manager
     * @param planType
     * @param submit
     * @param start
     * @param rows
     * @return
     */
    List<CheckRecord> queryByCondition(@Param("planId") String planId,@Param("userCode") String userCode,@Param("corpCode") String corpCode,@Param("gridCode") String gridCode,
                                       @Param("manager") String manager,@Param("planType") Integer planType,
                                       @Param("submit") Integer submit,@Param("start") Integer start,
                                       @Param("rows") Integer rows,@Param("keyword") String keyword);

    /**
     * 根据指定条件统计检查记录
     * @param userCode
     * @param corpCode
     * @param gridCode
     * @param manager
     * @param planType
     * @param submit
     * @return
     */
    Integer countByCondition(@Param("planId") String planId,@Param("userCode") String userCode,@Param("corpCode") String corpCode,@Param("gridCode") String gridCode,@Param("manager") String manager,
                             @Param("planType") Integer planType,@Param("submit") Integer submit,@Param("keyword") String keyword);

    /**
     * 根据查询条件查询指定检查计划下的检查记录列表
     * @param planId
     * @param corpCode
     * @param gridCode
     * @param manager
     * @param planType
     * @param submit
     * @param start
     * @param rows
     * @return
     */
    List<CheckRecord> queryByPlanId(@Param("planId") String planId,@Param("corpCode") String corpCode,@Param("gridCode") String gridCode,@Param("manager") String manager,
                                    @Param("planType") Integer planType,@Param("submit") Integer submit,@Param("start") Integer start,@Param("rows") Integer rows);

    /**
     * 根据查询条件统计指定检查计划下的检查记录
     * @param planId
     * @param corpCode
     * @param gridCode
     * @param manager
     * @param planType
     * @param submit
     * @return
     */
    Integer countByPlanId(@Param("planId") String planId,@Param("corpCode") String corpCode,@Param("gridCode") String gridCode,@Param("manager") String manager,
                          @Param("planType") Integer planType,@Param("submit") Integer submit);

    /**
     * 新增检查记录
     * @param bean
     * @return
     */
    Integer insert(@Param("bean") CheckRecord bean);

    /**
     * 批量插入检查记录，用于根据检查计划生成检查记录，用于对比实际的
     * @param checkRecordList
     * @return
     */
    Integer batchInsertProduce(@Param("checkRecordList") List<CheckRecord> checkRecordList);

    /**
     * 修改检查记录
     * @param bean
     * @return
     */
    Integer update(@Param("bean") CheckRecord bean);

    /**
     * 根据code统计，用于生成检查记录的code
     * @param code
     * @return
     */
    Integer count(@Param("code") String code);

    /**
     * 批量删除检查记录
     * @param idList
     * @return
     */
    Integer deleteBatch(@Param("idList") List<String> idList);

    /**
     * PC端首页安全检查记录列表
     * @param complexCode
     * @param code
     * @param start
     * @param rows
     * @return
     */
    List<CheckRecord> indexCheckRecordList(@Param("complexCode") String complexCode,@Param("code") String code,@Param("start") Integer start,@Param("rows") Integer rows);

    /**
     * 统计PC端首页安全检查记录数量
     * @param complexCode
     * @param code
     * @return
     */
    Integer countIndexCheckRecordList(@Param("complexCode") String complexCode,@Param("code") String code);

    Integer batchInsertHiddenDangerDiscovery(@Param("dangerDiscoveryList")List<HiddenDangerDiscovery> dangerDiscoveryList);

    Integer checkHiddenDangerDiscovery(@Param("checkRecordId") String checkRecordId, @Param("itemCheckRecordId") String itemCheckRecordId);

    Integer updateWorkflowEditState(@Param("id") String id, @Param("workflowEditState") Integer workflowEditState);

    Integer updateNextParticipantCode(@Param("id") String id, @Param("nextParticipantCode") String nextParticipantCode);

    Integer queryCheckCountByCorpAndTime(@Param("deptCodes") String deptCodes, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<CheckRecord> homePageCheckList(@Param("planId")String planId, @Param("corpCode")String corpCode, @Param("gridCode")String gridCode, @Param("manager")String manager, @Param("planType")Integer planType, @Param("submit")Integer submit,@Param("start") Integer start, @Param("rows")Integer rows);

    Integer homePageCheckCount(@Param("planId")String planId, @Param("corpCode")String corpCode, @Param("gridCode")String gridCode, @Param("manager")String manager, @Param("planType")Integer planType, @Param("submit")Integer submit);

    Integer updateCheckNoticeCode(@Param("noticeCodes") String noticeCodes, @Param("id")String id);

    List<CheckRecord> queryCheckRecordByPlanIds(@Param("planIds") List<String> planIds);

}
